<template>
  <!--登录 -->
  <view class="page-content">
    <view class="page-body" v-if="is_success===1?true:is_success===2?true:false">
      <image class="img" :class="is_success===1?'company-on':'company-no'" :src="is_success===1?is_s:is_f"></image>
      <view class="title">{{is_success===1?'注册成功':'注册失败'}}！</view>
      <view class="txt" >{{is_success===1?'恭喜您成功注册！':fail_txt}}</view>
      <view class="txt" v-if="is_success===1">您的信息已经录入，欢迎您的使用。</view>
    </view>
    <view v-show="isloadding==='loading'">
      <view class="example-body">
        <uni-load-more iconType="snow" :status="isloadding" color="#fff" />
      </view>
    </view>
    <view class="btn-row" v-if="is_success===2">
      <button type="primary" class="" @tap="confirm">返回首页</button>
    </view>
  </view>
</template>

<script>
import uniLoadMore from "@/components/uni-load-more/uni-load-more2.vue"
import {
  mapGetters,
  mapActions
} from 'vuex'
import  store  from '@/store'
//接口
import {
  setBaiduVerifyTokens, //使用verify_token注册数据
} from "@/api/index"
export default {
  components: {
    uniLoadMore
  },
  data() {
    return {
      is_s:'/static/img/success.png',
      is_f:'/static/img/fail.png',
      params: {
        mobile: '',
        pass: ''
      },
      formdata:{
        mobile: '',
        sms_code:'',
        pass: '',
        type:'3344',
        sms_type:'3344'
      },
      btnText:'获取验证码',
      btnDis:false,
      is_success:3,
      fail_txt:'',
      isloadding: '',
      manager_id:'',
      uid:'',
    }
  },
  onLoad(option) {
    console.log(222)
    let verify_token = this.options['verify_token'];
    if(!!verify_token){
      this.setdata(verify_token);
    }
    let manager_id = this.options['manager_id'];
    let uid = this.options['uid'];
    if(!!manager_id){
      this.manager_id = manager_id;
    }
    if(!!uid){
      this.uid = uid;
    }
  },
  methods: {
    ...mapActions('user',['setToken']),
    setdata(verify_token){
      let _self = this;
      _self.isloadding = 'loading';
      setBaiduVerifyTokens({verify_token:verify_token}).then(res =>{
        console.log(333,res)
        _self.isloadding = 'loaded';
        if(res.code===1){
          this.is_success = 1;
        }else {
          this.is_success = 2;
          this.fail_txt = res.msg;
        }
      })
    },
    getQueryVariable(variable) {
      var query = window.location.search.substring(1);
      var vars = query.split("&");
      for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if(pair[0] == variable){return pair[1];}
        console.log(vars[i])
      }
      return(false);
    },
    //跳转忘记密码
    confirm() {
      uni.navigateTo({
        url: `/pages/index/index?manager_id=${this.manager_id}&uid=${this.uid}`
      })
    },
    back() {
      uni.navigateBack({
        delta: 1
      })
    },
  }
}
</script>

<style lang="scss">
.btn-row {
  position: fixed;
  height: 100rpx;
  left: 0;
  right: 0;
  bottom: 0;

  button {
    line-height: 100rpx;
    background: #4566FF;
    font-size: 36rpx;
    color: #fff;
    height: 100rpx;
    border-radius: 0;
  }
}
.example-body{
  position: fixed;
  z-index: 999;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  left: calc(50% - 150rpx);
  top: calc(50% - 150rpx);
  width: 300rpx;
  height: 300rpx;
  background: rgba(0,0,0,0.2);
}
.det-con-more {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10rpx;
  color: #bbb;
  font-size: 24rpx;
}
.icon-tb {
  width: 32rpx;
  height: 32rpx;
  margin-right: 20rpx;
}
.page-content {
  background: #fff;
  width: 100vw;
  .page-body{
    display: flex;
    flex-direction: column;
    align-items: center;
    .img{
      display: flex;
    }
    .company-on{
      width: 510rpx;
      height: 290rpx;
      margin:30rpx auto 40rpx;
    }
    .company-no{
      width: 490rpx;
      height: 370rpx;
      margin:60rpx auto 20rpx;
    }
    .title{
      font-size: 60rpx;
      font-weight: bold;
      line-height: 97rpx;
      color: #333333;
      margin: 0rpx auto 100rpx;
    }
    .txt{
      font-size: 30rpx;
      font-weight: 400;
      line-height: 56rpx;
      color: #666666;
    }
    .btn-row {
      width: 100%;
      padding: 0 30rpx;


      .icons{
        margin-left: 30rpx;
        font-weight: 600;
        font-size: 36rpx;
      }
    }
  }
}
</style>
